package com.atguigu.study.pay;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringBootVersion;
import org.springframework.core.SpringVersion;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
@Slf4j
public class PayControllerV2
{
    @Resource
    private PayServiceV2 payServicev2;

    //http://localhost:2 405/payv2?p1=1
    @GetMapping(value = "/payv2")
    public void payByAop(@RequestParam("p1") String p1)
    {
        System.out.println("SpringVersion: "+ SpringVersion.getVersion()+"\t"+ "SpringBootVersion: "+ SpringBootVersion.getVersion());
        System.out.println("----p1: "+p1);
        payServicev2.payV2();
    }

    // http://localhost:2405/payv2/error
    @GetMapping(value = "/payv2/error")
    public void payByAopError()
    {
        System.out.println("SpringVersion: "+ SpringVersion.getVersion()+"\t"+ "SpringBootVersion: "+ SpringBootVersion.getVersion());
        payServicev2.payV2Error();
    }
}
